<?php

use yii\helpers\Html;
use yii\grid\GridView;

/* @var $this yii\web\View */
/* @var $searchModel common\models\AdminLogSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = '管理员操作日志';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="admin-log-index">

    <?php // echo $this->render('_search', ['model' => $searchModel]); ?>

    <?= GridView::widget([
        'dataProvider' => $dataProvider,
        'filterModel' => $searchModel,
        'columns' => [
            [
                'header' => "操作",
                'class' => 'yii\grid\ActionColumn',
                'template' => '{view}',
                'buttons' => [
                    'view' => function ($url, $model, $key) {
                        $options = [
                            'title' => Yii::t('yii', '查看'),
                            'class' => 'btn btn-xs btn-info',
                        ];
                        return Html::a('<span class="glyphicon glyphicon-eye-open"></span>', $url, $options);
                    },
                ],
                'headerOptions' => ['width' => '50'],
            ],

            [
                'attribute' => 'user_id',
                'value' => 'user_id',
                'headerOptions' => ['width' => '50'],
            ],
            'route',
            [
                'attribute'=>'description',
                'format'=>'html',
                'value'=>function($model){
                    return "<div style='white-space: pre-wrap;'>$model->description</div>";
                },
            ],
            [
                'attribute'=>'created_at',
                'value'=>function($model){
                    return date('Y-m-d H:i:s',$model->created_at);
                },
            ],
        ],
    ]); ?>


</div>
